Lines Matching refs:dip

259 struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)  in gfs2_lookup_simple()  argument
264 inode = gfs2_lookupi(dip, &qstr, 1); in gfs2_lookup_simple()
295 struct gfs2_inode *dip = GFS2_I(dir); in gfs2_lookupi() local
311 if (gfs2_glock_is_locked_by_me(dip->i_gl) == NULL) { in gfs2_lookupi()
312 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh); in gfs2_lookupi()
343 static int create_ok(struct gfs2_inode *dip, const struct qstr *name, in create_ok() argument
348 error = gfs2_permission(&init_user_ns, &dip->i_inode, in create_ok()
354 if (!dip->i_inode.i_nlink) in create_ok()
357 if (dip->i_entries == (u32)-1) in create_ok()
359 if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1) in create_ok()
365 static void munge_mode_uid_gid(const struct gfs2_inode *dip, in munge_mode_uid_gid() argument
368 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && in munge_mode_uid_gid()
369 (dip->i_inode.i_mode & S_ISUID) && in munge_mode_uid_gid()
370 !uid_eq(dip->i_inode.i_uid, GLOBAL_ROOT_UID)) { in munge_mode_uid_gid()
373 else if (!uid_eq(dip->i_inode.i_uid, current_fsuid())) in munge_mode_uid_gid()
375 inode->i_uid = dip->i_inode.i_uid; in munge_mode_uid_gid()
379 if (dip->i_inode.i_mode & S_ISGID) { in munge_mode_uid_gid()
382 inode->i_gid = dip->i_inode.i_gid; in munge_mode_uid_gid()
472 static void init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip, in init_dinode() argument
494 gfs2_init_dir(dibh, dip); in init_dinode()
519 static unsigned gfs2_trans_da_blks(const struct gfs2_inode *dip, in gfs2_trans_da_blks() argument
523 return da->nr_blocks + gfs2_rg_blocks(dip, da->nr_blocks) + in gfs2_trans_da_blks()
527 static int link_dinode(struct gfs2_inode *dip, const struct qstr *name, in link_dinode() argument
530 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in link_dinode()
535 error = gfs2_quota_lock_check(dip, &ap); in link_dinode()
539 error = gfs2_inplace_reserve(dip, &ap); in link_dinode()
543 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, da, 2), 0); in link_dinode()
552 error = gfs2_dir_add(&dip->i_inode, name, ip, da); in link_dinode()
556 gfs2_inplace_release(dip); in link_dinode()
558 gfs2_quota_unlock(dip); in link_dinode()
601 struct gfs2_inode *dip = GFS2_I(dir), *ip; in gfs2_create_inode() local
602 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in gfs2_create_inode()
612 error = gfs2_qa_get(dip); in gfs2_create_inode()
620 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); in gfs2_create_inode()
625 error = create_ok(dip, name, mode); in gfs2_create_inode()
674 munge_mode_uid_gid(dip, inode); in gfs2_create_inode()
675 check_and_update_goal(dip); in gfs2_create_inode()
676 ip->i_goal = dip->i_goal; in gfs2_create_inode()
686 if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) || in gfs2_create_inode()
692 ip->i_diskflags |= (dip->i_diskflags & GFS2_DIF_INHERIT_JDATA); in gfs2_create_inode()
699 if (dip->i_diskflags & GFS2_DIF_SYSTEM) in gfs2_create_inode()
704 if ((GFS2_I(d_inode(sdp->sd_root_dir)) == dip) || in gfs2_create_inode()
705 (dip->i_diskflags & GFS2_DIF_TOPDIR)) in gfs2_create_inode()
746 init_dinode(dip, ip, symname); in gfs2_create_inode()
771 error = security_inode_init_security(&ip->i_inode, &dip->i_inode, name, in gfs2_create_inode()
776 error = link_dinode(dip, name, ip, &da); in gfs2_create_inode()
792 gfs2_qa_put(dip); in gfs2_create_inode()
830 gfs2_qa_put(dip); in gfs2_create_inode()
922 struct gfs2_inode *dip = GFS2_I(dir); in gfs2_link() local
934 error = gfs2_qa_get(dip); in gfs2_link()
938 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); in gfs2_link()
969 if (!dip->i_inode.i_nlink) in gfs2_link()
972 if (dip->i_entries == (u32)-1) in gfs2_link()
990 error = gfs2_quota_lock_check(dip, &ap); in gfs2_link()
994 error = gfs2_inplace_reserve(dip, &ap); in gfs2_link()
998 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, &da, 2), 0); in gfs2_link()
1028 gfs2_inplace_release(dip); in gfs2_link()
1031 gfs2_quota_unlock(dip); in gfs2_link()
1038 gfs2_qa_put(dip); in gfs2_link()
1055 static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, in gfs2_unlink_ok() argument
1063 if ((dip->i_inode.i_mode & S_ISVTX) && in gfs2_unlink_ok()
1064 !uid_eq(dip->i_inode.i_uid, current_fsuid()) && in gfs2_unlink_ok()
1068 if (IS_APPEND(&dip->i_inode)) in gfs2_unlink_ok()
1071 error = gfs2_permission(&init_user_ns, &dip->i_inode, in gfs2_unlink_ok()
1076 return gfs2_dir_check(&dip->i_inode, name, ip); in gfs2_unlink_ok()
1090 static int gfs2_unlink_inode(struct gfs2_inode *dip, in gfs2_unlink_inode() argument
1097 error = gfs2_dir_del(dip, dentry); in gfs2_unlink_inode()
1127 struct gfs2_inode *dip = GFS2_I(dir); in gfs2_unlink() local
1141 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); in gfs2_unlink()
1173 error = gfs2_unlink_ok(dip, &dentry->d_name, ip); in gfs2_unlink()
1181 error = gfs2_unlink_inode(dip, dentry); in gfs2_unlink()